package br.com.jvet.persistencia;

import javax.ejb.Stateless;
import javax.persistence.Query;

import br.com.jvet.entidade.Cliente;

@Stateless
public class ClienteDAO extends AbstractDAO<Cliente, Integer> {

	public ClienteDAO() {
		super();

	}
	
	public boolean consultarPorCnpjCpf(Cliente cliente) {
		Query c = super.getEntityManager().createQuery("SELECT c FROM "+Cliente.class
				+ " c where cnpjcpf = :cnpjcpf");

		c.setParameter("cnpjcpf", cliente.getDadosCadastro().getCnpjCpf());

		if (c.getResultList() != null && c.getResultList().size() > 0) {
			return true;
		}
		return false;
	}

}
